import org.junit.Test;

import java.util.ArrayList;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

/**
 * Created with IntelliJ IDEA.
 * User: kush
 * Date: 01/08/13
 * Time: 10:35 PM
 * To change this template use File | Settings | File Templates.
 */
public class SentanceTest {

    @Test
    public void anagramOfaIsa()
    {
        ArrayList output = new Sentance("a").generateAnagram(0);
        assertArrayEquals(new String[]{"a"}, (String[])output.toArray(new String[output.size()]));
    }
    @Test
    public void anagramOfbIsb()
    {
        ArrayList output = new Sentance("b").generateAnagram(0);
        assertArrayEquals(new String[]{"b"}, (String[])output.toArray(new String[output.size()]));
    }

    @Test
    public void swapIandIILetterOfabIsba(){
        assertEquals("ba",new Sentance("ab").swapCharacters(0,1));
    }

    @Test
    public void anagramOfabIsabAndba()
    {
        ArrayList output = new Sentance("ab").generateAnagram(0);
        assertArrayEquals(new String[]{"ab","ba"}, (String[])output.toArray(new String[output.size()]));
    }

    @Test
    public void anagramOfabcIsSixStringsOfItsAnagram()
    {
        ArrayList output = new Sentance("abc").generateAnagram(0);
        assertArrayEquals(new String[]{"abc","acb","bac","bca","cba","cab"}, (String[])output.toArray(new String[output.size()]));
    }


}
